package com.ctvit.sjk.knowledge.model.controller;

import com.ctvit.sjk.knowledge.model.pojo.domain.TabModelParamSetting;
import com.ctvit.sjk.knowledge.model.service.ITabModelParamSettingService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 模型参数设置设置参数Controller
 *
 * @author heyingcheng
 * @date 2025/3/22
 */
@RestController
@RequestMapping("knowledge/model/param/setting")
public class TabModelParamSettingController extends BaseController {

    private final ITabModelParamSettingService tabModelSettingParamService;

    public TabModelParamSettingController(ITabModelParamSettingService tabModelSettingParamService) {
        this.tabModelSettingParamService = tabModelSettingParamService;
    }

    /**
     * 查询模型参数设置列表
     */
    @PostMapping("list")
    public TableDataInfo list() {
        return getDataTable(tabModelSettingParamService.list());
    }

    /**
     * 获取模型参数设置详细信息
     */
    @PostMapping(value = "get")
    public AjaxResult get(@RequestParam String id) {
        return success(tabModelSettingParamService.getById(id));
    }

    /**
     * 新增模型参数设置
     */
    @Log(title = "模型参数设置", businessType = BusinessType.INSERT)
    @PostMapping(value = "add")
    public AjaxResult add(@RequestBody TabModelParamSetting entity) {
        return toAjax(tabModelSettingParamService.save(entity));
    }

    /**
     * 修改模型参数设置
     */
    @Log(title = "模型参数设置", businessType = BusinessType.UPDATE)
    @PostMapping(value = "edit")
    public AjaxResult edit(@RequestBody TabModelParamSetting entity) {
        return toAjax(tabModelSettingParamService.updateById(entity));
    }

    /**
     * 删除模型参数设置
     */
    @Log(title = "模型参数设置", businessType = BusinessType.DELETE)
    @PostMapping("remove")
    public AjaxResult remove(@RequestBody List<String> ids) {
        return toAjax(tabModelSettingParamService.removeByIds(ids));
    }

}
